<template>

</template>

<script>
import $ from '@/common';
import Ws from '@/websocket';
export default {
	data() {
		return {
			path: {
				list: 'x',
				ws: 'x',
			},
			messageData: [],
			counter: 0,
			wsError: false,
		};
	},
	methods: {
		fetch() {
			$.link(this.path.list).then(() => {});
		},
		addRow(row) {
			this.counter++;
			messageData.shift({ ...row, _read: false });
    },
    //点击打开信息栏是尝试刷新状态 链接重试？
		update() {},
	},
	created() {
		Ws.connect(this.path.ws);
		Ws.on('messsage', data => {
			for (let row of this.messageData) {
				if (data.id === row.id) {
					return;
				}
			}
			this.messageData.addRow(data);
		});
		Ws.on('error', data => {
			this.wsError = true;
		});
	},
	components: {},
};
</script>

<style>

</style>
